#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2016-2019, Intel Corporation

#
# src/test/ex_libpmemobj/TEST20 -- unit test for libpmemobj examples
#

. ../unittest/unittest.sh

require_test_type medium

require_build_type debug nondebug

setup

EX_PATH=../../examples/libpmemobj/array

expect_normal_exit $EX_PATH/array $DIR/testfile alloc int 23 int > out$UNITTEST_NUM.log
expect_normal_exit $EX_PATH/array $DIR/testfile alloc PMEMoid 17 PMEMoid >> out$UNITTEST_NUM.log
expect_normal_exit $EX_PATH/array $DIR/testfile alloc TOID 11 TOID >> out$UNITTEST_NUM.log

expect_normal_exit $EX_PATH/array $DIR/testfile print int >> out$UNITTEST_NUM.log
expect_normal_exit $EX_PATH/array $DIR/testfile print PMEMoid >> out$UNITTEST_NUM.log
expect_normal_exit $EX_PATH/array $DIR/testfile print TOID >> out$UNITTEST_NUM.log

expect_normal_exit $EX_PATH/array $DIR/testfile realloc int 17 >> out$UNITTEST_NUM.log
expect_normal_exit $EX_PATH/array $DIR/testfile realloc PMEMoid 11 >> out$UNITTEST_NUM.log
expect_normal_exit $EX_PATH/array $DIR/testfile realloc TOID 13 >> out$UNITTEST_NUM.log

expect_normal_exit $EX_PATH/array $DIR/testfile print int >> out$UNITTEST_NUM.log
expect_normal_exit $EX_PATH/array $DIR/testfile print PMEMoid >> out$UNITTEST_NUM.log
expect_normal_exit $EX_PATH/array $DIR/testfile print TOID >> out$UNITTEST_NUM.log

check

pass
